package edu.mtu.citizenscience.mushroommapper.model.fieldguide;

import com.openswimsoftware.orm.model.ModelFile;
import com.openswimsoftware.orm.model.annotation.Parent;

import android.content.Context;

import edu.mtu.citizenscience.mushroommapper.model.ModelGuideMushroom;

/**
 * @author Corbin Uselton <corbinu@cwuselto@mtu.edu>
 * @copyright (c) 2012 MichiganTech <http://www.mtu.edu>
 * @since 1.0
 * 
 * Model of a guide mushroom image in the app DB belongs to a guide mushroom
 */
public class ModelGuideImage extends ModelFile<ModelGuideImage> {
	
	// the guide images parent guide mushroom
	@Parent
	public ModelGuideMushroom mushroom;
	
	/**
	 * Create the guide image model
	 * 
	 * @param   context - Context - context for model operations
	 * @return	void
	 */
	public ModelGuideImage(Context context) 
	{
		super(context, ModelGuideImage.class);
	}

	/**
	 * Create the guide image model
	 * 
	 * @param   context - Context - context for model operations
	 * @param	id - long - the id of the model to load
	 * @return	void
	 */
	public ModelGuideImage(Context context, long id) 
	{
		super(context, ModelGuideImage.class, id);
	}
	
	/**
	 * Get the parent guide mushroom
	 * 
	 * @param   void
	 * @return	ModelGuideMushroom - parent guide mushroom model
	 */
	public ModelGuideMushroom getMushroom()
	{
		// make sure the model is loaded
		this.load();
		
		return this.mushroom;
	}
	
	/**
	 * Set the parent guide mushroom
	 * 
	 * @param   mushroom - ModelGuideMushroom - parent guide mushroom model
	 * @return	void
	 */
	public void setMushroom(ModelGuideMushroom mushroom)
	{
		// mark the model as updated
		this.updated = true;
		
		this.mushroom = mushroom;
	}
	
}
